﻿using System;
using MCP.Data.Client.Message.Enum;

namespace MCP.Data.Client.Message
{
	public abstract class MessageBase
	{
		public string Text { get; set; }
		public MessagePriority Priority { get; set; }
		public MessageType Type { get; set; }
		public DateTime? Date { get; set; }

	    protected MessageBase()
        {
            this.Date = DateTime.Now;
        }

        protected MessageBase(string message, MessagePriority priority, MessageType type, DateTime? date = null)
        {
            this.Text = message;
            this.Priority = priority;
            this.Type = type;
            this.Date = date ?? DateTime.Now;
        }

        public bool IsErrorMessage()
        {
            return (this as ErrorMessage) != null;
        }
	}
}